package com.turkline.CatchMePolygon;

import com.badlogic.androidgames.framework.Game;
import com.badlogic.androidgames.framework.Input.TouchEvent;
import com.badlogic.androidgames.framework.gl.Camera2D;
import com.badlogic.androidgames.framework.gl.SpriteBatcher;
import com.badlogic.androidgames.framework.impl.GLGraphics;
import com.badlogic.androidgames.framework.math.OverlapTester;
import com.badlogic.androidgames.framework.math.Vector2;


public class Help
{
	SpriteBatcher batcher;
	Vector2 touchPoint;
	GLGraphics glGraphics;
	Game game;
	Camera2D camera;
	float stateTime = 0;
	float yValue = -300;
	
	public Help(GLGraphics glGraphics , SpriteBatcher batcher , Game game)
	{
		this.game = game;
		touchPoint = new Vector2();
		this.batcher = batcher;
		this.glGraphics = glGraphics;
		camera = new Camera2D(glGraphics, 800, 480);
	}
	
	public void update(float deltaTime , TouchEvent touchEvent)
	{
		if(touchEvent != null)
		{
			touchPoint = new Vector2(touchEvent.x, 480-touchEvent.y);
			if(OverlapTester.pointInRectangle(Assets.helpClose, touchPoint) && touchEvent.type == TouchEvent.TOUCH_UP)
			{
				if(!Settings.firstHelpShowed)
				{
					Settings.firstHelpShowed = true;
				}
				if(Settings.showHelpStartScreen)
				{
					Settings.showHelpStartScreen = false;
				}
			}
		}
		
		yValue += (220-yValue)/10;
	}
	
	public void present(float deltaTime)
	{
		batcher.beginBatch(Assets.items2);
		batcher.drawSprite(400, yValue, 736, 448, 1, Assets.helpRegion);
		batcher.endBatch();
	}
}
